<?php include DIR_MODULES . 'menu/menu_main_oferte.php'; ?>

<table class="oferta_finala_root" cellpadding="0" cellspacing="0" width="100%" border="0">
	<tr>
		<td colspan="2" class="OF_gallery" valign="top">
                    <?php
                    $breadcrumbs = mysql_query("select * from dt_categories where c_id = '".$_GET['cid']."'");
                    $breadcrumb = mysql_fetch_array($breadcrumbs);
                    echo '<div class="crumbs">'.$breadcrumb['c_title'].'</div>';
                    ?>
                    <div class="mijloc_hr">&nbsp;</div>
			<!-- galeria de sus ============================================ -->
                        <?php
                            $testhead = mysql_query("select * from dt_offers_photos where o_id = '".$_GET['pid']."'");
                            if(mysql_num_rows($testhead)>= '1'){
                        ?>
			<div id="galerie_corp">
				<div id="galerie_overlay">
					<img alt="" src="../../../templates/default/images/corner-galerie.png" width="25" height="25">
				</div>
				<div id="galerie_child_corp">
					<?php include DIR_MODULES . 'galerie_header/index.php';?>
				</div>
			</div>
                        <?php }?>
			<!-- end galeria =============================================== -->
		</td>
		<td rowspan="3" class="coloana_separator" valign="top">&nbsp;</td>
		<td rowspan="3" class="OF_dreapta" valign="top">

		<?php 
                    $cDreapta = mysql_query("select * from dt_mod_visible where z_id = '2' and visible = '1' and c_id = '".$_GET['cid']."' order by `order`");
                    include DIR_MODULES . 'coloane_module/coloana_dreapta.php';
		?>
		</td>
	</tr>
	<tr>
		<td colspan="2" class="OF_toolbar" valign="top">
            <img src="../../../templates/default/images/tag-share.png" width="" height="25" align="absmiddle" alt="share" />
            <a href="http://www.facebook.com/share.php?u=<?php echo 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]?>"><img align="absmiddle" src="../../../templates/default/images/icon-facebook-mic.png" alt="" /></a>
            <a href="http://twitter.com/share" data-url="<?php echo 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]?>" data-count="none"><img src="../../../templates/default/images/icon-twitter-mic.png" width="25" height="25" align="absmiddle" alt="tweet" /></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
            &nbsp;&nbsp;
            <img src="../../../templates/default/images/tag-email.png" width="" height="25" align="absmiddle" alt="e-mail" />
            <a href="#emailpopup" class="email" id="email"><img src="../../../templates/default/images/icon-mail-mic.png" width="25" height="25" align="absmiddle" alt="" /></a>
            <img src="../../../templates/default/images/tag-print.png" width="" height="25" align="absmiddle" alt="print" />
			<!-- <a href="javascript:window:print()"><img src="../../../templates/default/images/icon-print-mic.png" width="25" height="25" align="absmiddle" alt="" /></a> -->
			<a href="../../../index.php?pg=print&id=<?php echo $_GET['pid'];?>" target="_blank"><img src="../../../templates/default/images/icon-print-mic.png" width="25" height="25" align="absmiddle" alt="" /></a>
			



<style type="text/css">
#tellfriend {
    position: absolute;
    margin-top: -300px;
    left: 400px;
    color: #fff;
    padding: 15px;
    margin-bottom: 20px;
    width: 380px;
    z-index: 1;
    border: 1px solid #ccc;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    background-color: #f2f2f2;
}

#tellfriend a.close {
    position: absolute;
    right: -10px;
    top: -10px;
    background: url(../../../templates/default/images/fancy_closebox.png) no-repeat;
    height: 30px;
    width: 30px;
    overflow: hidden;
    text-indent: -1000px;
}

#tellfriend form textarea {
    height: 80px;
}

.contact-form {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    background-color: #f2f2f2;
}

.contact-form form input.std_input {
    margin-bottom: 10px;
}

form label.clear {
    clear: both;
    float: left;
    margin-top: 10px;
}

form label.full {
    width: 99%;
}

form label.required {
    font-weight: bold;
}

form select {
    margin-bottom: 10px;
    background-color: #fff;
    border: 1px solid #ccc;
    font: 14px "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
    color: #6e6e6e;
}

form label {
    color: #808080;
    font-size: 14px;
}

form input.std_input,
form textarea {
    border: 1px solid #ccc;
    width: 97%;
    font: 15px "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
    padding: 5px;
    color: #6e6e6e;
}

form table {
    width: 100%;
}

form table input.std_input {
    width: 93%;
}

form table.three-col input.std_input {
    width: 90%;
}

form input.form_but {
    margin-top: 10px;
    background-color: #93ba31;
    border: 3px solid #afdd39;
    color: #fff;
    font: bold 15px "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    padding: 5px 10px;
}
</style>


<div id="tellfriend" class="contact_form" align="left">
 <a class="close" href="#close" >Close</a>
 <form id='tellafriend_form' method="post" action="../../../modules/offers/send.php">

    <label for="from">Your Email: </label>
        <input class="std_input" type="text" id="from" name="from" size="40" maxlength="35" value="" />

     <label for="name">Your Name: </label>
     <input class="std_input" type="text" id="name" name="name" size="40" maxlength="35" value="" />

     <label for="to">To: </label>
     <input class="std_input" type="text" id="to" name="to" size="40" maxlength="35" />

     <label for="subject">Subject: </label>
     <input class="std_input" type="text" id="subject" name="subject" size="40" value="" />

     <label for="message">Message: </label>
     <textarea id="message" name="message" readonly="readonly" rows="18" cols="40">
     <?php echo 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]?>
     </textarea>
     <input type="hidden" name="path" value="<?php echo 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]?>" />

     <input type="submit" name="submit" class="form_but" value="Submit" id="submit_btn"/>
</form>
 </div>

<script type="text/javascript">
    jQuery.fn.fadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle'}, speed, easing, callback);
    };

    $(document).ready(function() {
        $('#tellfriend').hide();
        $('#email, #tellfriend a.close').click(function() {
        $("#tellfriend").fadeToggle('slow');
      });
    });
</script>


                <div class="mijloc_hr">&nbsp;</div>
                <?php
                $db = mysql_query("select * from dt_offers where o_id = '".$_GET['pid']."'");
                $r = mysql_fetch_array($db);
//                $gg = explode("##END##", $r['o_content']);
//                $c = count($gg);
//                if($c>1)
//                    echo '<p>'.$gg[0].'</p>';
                echo '<p>'.$r['o_small_desc'].'</p>';
                ?>
            </td>
	</tr>
	<tr>
            <?php
                $data = mysql_query("select * from dt_offers where o_id = '".$_GET['pid']."'");
                while ($row = mysql_fetch_array($data)){
                    $price = $row['o_price'];
                    $price_type = $row['o_price_type'];
                    $start_date = $row['o_start_date'];
                    $end_date = $row['o_end_date'];
                    $mese_include = $row['mese_incluse'];
                    $orase_vizitate = $row['orase_vizitate'];
                    $excursii_optionale = $row['excursii_optionale'];
                    
                    if ($price != '' || $price_type != '' || $start_date != '' || 
                        $end_date != '' || $mese_incluse != '' || 
                        $orase_vizitate != '' || $excursii_optionale != '') {
                        
                        echo '<td class="OF_stanga" id="coloana_stanga_root_var" valign="top">
                            <div class="cb"><img src="../../../templates/default/images/corner-exterior-jos_var.png" width="25" height="15"></div>
                            <table id="os0_var" cellpadding="0" cellspacing="0" width="100%" border="0">
                            <tr>
                            <td id="os1" valign="top">
                            <!-- oferte speciale ////////////////////////////////////// -->
                            <div id="oferte_root">';
                        echo '<br />';
                        
                        if ($row['o_price'] != '' && $row['o_price_type'] != '') {
                           echo '<div class="o_titlu">Pret circuit:</div>';
                           echo '<div class="o_info">de la '.$row['o_price'].' '.$row['o_price_type'].'</div>';
                        }
                        if ($row['o_end_date'] != '' && $row['o_start_date'] != '') {
                            echo '<div class="o_titlu">Durata sejur:</div>';
                            if ($row['o_end_date'] != '')
                                echo '<div class="o_info">'.$row['o_end_date'].',';
                            if ($row['o_start_date'] != '')
                                echo 'incepand cu '.$row['o_start_date'].'</div>';
                            //echo '<div class="o_info">'.$row['o_end_date'].', incepand cu '.$row['o_start_date'].'</div>';
                        }

                        if ($row['mese_incluse'] != ''){
                            $string = $row['mese_incluse'];
                            $array = explode(",", $string);
                            $count = count($array);

                            echo '<div class="o_titlu">Mese incluse:</div>';
                            echo '<div class="o_info"><ul>';
                            for($i=0;$i<$count;$i++){
                                echo '<li>' . $array[$i].'</li>';
                            }
                            echo '</ul></div>';
                        }
                        if ($row['orase_vizitate'] != ''){
                            $string = $row['orase_vizitate'];
                            $array = explode(",", $string);
                            $count = count($array);

                            echo '<div class="o_titlu">Orase vizitate:</div>';
                            echo '<div class="o_info"><ul>';
                            for($i=0;$i<$count;$i++){
                                echo '<li>' . $array[$i].'</li>';
                            }
                            echo '</ul></div>';
                        }
                        if ($row['excursii_optionale'] != ''){
                            $string = $row['excursii_optionale'];
                            $array = explode(",", $string);
                            $count = count($array);

                            echo '<div class="o_titlu">Excursii optionale:</div>';
                            echo '<div class="o_info"><ul>';
                            for($i=0;$i<$count;$i++){
                                echo '<li>' . $array[$i].'</li>';
                            }
                            echo '</ul></div>';
                        }
                        echo '<br />';
                        echo '</div>
                            <!-- end oferte speciale ////////////////////////////////// -->
                            </td>
                            <td id="os2" valign="top"><img src="../../../templates/default/images/corner-meniu-sus.png" width="25" height="25"></td>
                            </tr></table>
                            <div class="cb"><img src="../../../templates/default/images/corner-exterior-sus_var.png" width="25" height="15"></div>';

                        //$cStanga = mysql_query("select * from dt_mod_visible where z_id = '1' and visible = '1' and o_id = '".$_GET['pid']."' order by `order`");
                        //include DIR_MODULES . 'coloane_module/coloana_stanga.php';
                        echo '</td>';
                    }
                }
            ?>

		<td class="OF_mijloc" valign="top">
                    <?php
                    if ($price != '' || $price_type != '' || $start_date != '' || 
                        $end_date != '' || $mese_incluse != '' || 
                        $orase_vizitate != '' || $excursii_optionale != '') {
                        echo '<div class="OF_mijloc_holder">';
                    } else {
                        echo '<div class="OF_mijloc_holder_exceptie">';
                    }
                    ?>
			
		<?php
                    $folderQuery = mysql_query("select * from dt_offers where o_id = '".$_GET['pid']."'");
                    $folderRow = mysql_fetch_array($folderQuery);

                    $audioQuery = mysql_query("select * from dt_offers_mp3 where o_id = '".$_GET['pid']."'");
                    while($audioRow = mysql_fetch_array($audioQuery)){
                        $xmlName = substr($audioRow['file'], 0, -4);
                        $playerAudio = '<div id="al_lui_kola" style="background:#f2f2f2;padding:5px;border:1px #CCCCCC solid;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;">
                                        <script type="text/javascript" src="../../../ext/audio_player/js/swfobject.js"></script>
                                        <script type="text/javascript">
                                            var cacheBuster = "?t=" + Date.parse(new Date());
                                            var stageW = 450;
                                            var stageH = 75;
                                            var attributes = {};
                                            attributes.id = \'FlabellComponent\';
                                            attributes.name = attributes.id;
                                            var params = {};
                                            params.wmode = "window";
                                            params.allowfullscreen = "true";
                                            params.allowScriptAccess = "always";
                                            params.bgcolor = "#000000";
                                            var flashvars = {};
                                            flashvars.componentWidth = 450;
                                            flashvars.componentHeight = 79;
                                            flashvars.pathToFiles = "../../../uploads/offers/mp3/'.  cleanitup($folderRow['o_title']).'/";
                                            flashvars.xmlPath = "../settings.xml";
                                            flashvars.contentXmlPath = "'.$xmlName.'.xml";
                                            swfobject.embedSWF("../../../ext/audio_player/preview.swf"+cacheBuster, attributes.id, stageW, stageH, "9.0.124", "../../../ext/audio_player/js/expressInstall.swf", flashvars, params);
                                            if(swfmacmousewheel) swfmacmousewheel.registerObject(attributes.id);
                                        </script>
                                        <div id="FlabellComponent">
                                                <p>In order to view this object you need Flash Player 9+ support!</p>
                                                <a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/></a>
                                        </div>
                                    </div>';
                    }
                    
                    $data = mysql_query("select * from dt_offers where o_id = '".$_GET['pid']."'");
                    while ($row = mysql_fetch_array($data)){
//                        if($c>1){
//                            $replace = str_replace("{MP3PLAYER}", $playerAudio, $gg[1]);
//                            //echo $gg[1];
//                            echo $replace;
//                        } elseif($c<=1){
//                            $replace2 = str_replace("{MP3PLAYER}", $playerAudio, trimthem($row['o_content']));
//                            //echo trimthem($row['o_content']);
//                            echo $replace2;
//                        }
                        $replace = str_replace("{MP3PLAYER}", $playerAudio, $row['o_content']);
                        
	                    //if(strpos($row['p_content'], "<div><hr /></div>"))
							//$text = explode("<div><hr /></div>", $row['p_content']);
						//elseif (strpos($row['p_content'], "<hr />"))
							$text = explode("<hr />", $replace);
							
	                    $count = count($text);
	                    
	                    //paging
	                    $total_items = $count;
	                    $limit = 1;
	                    $page = 1;
	                    
	                    
	                    if((!$limit)  || (is_numeric($limit) == false) || ($limit < 1) || ($limit > 5)) {
	                    	$limit = 1; //default}
	                    }
	                    
	                    $total_pages = ceil($total_items / $limit);
	                    
	                    if ($total_items>0){
	                    	echo '<div id="paginationdemo" class="demo">';
	                    	for($i = 1; $i <= $total_pages; $i++){
	                    		$set_limit 	= $i * $limit - ($limit);
	                    		
	                    		$dataString = $text[$set_limit];
	                    		
	                    		if($i == 1){
	                    			echo '<div id="p'.$i.'" class="pagedemo _current">';
	                    			echo $dataString;
	                    			echo '</div>';
	                    		} else {
	                    			echo '<div id="p'.$i.'" class="pagedemo" style="display:none;">';
	                    			echo $dataString;
	                    			echo '</div>';
	                    		}
	                    	}
	                    	echo '<div id="demo5"></div>';
	                    	echo '</div>';
	                    }
                        
                        //echo $replace;

                        if ($row['o_housing'] != '')
                            echo '<div class="o_cazare">Cazare: <a href="'.$row['o_housing_link'].'">'.$row['o_housing'].'</a></div>';
                        if ($row['longitudine'] != '' && $row['latitudine'] != '')
                            echo '<a href="#bottom" id="maplink">Vezi pe harta</a>';
                    }
                    echo '<div class="o_titlu">Daca oferta noastra suna tentant, suna acum pentru rezervare:</div>';
                    $telephone = mysql_query("select * from dt_settings");
                    $telRow = mysql_fetch_array($telephone);
                    echo '<div class="o_tel">'.$telRow['s_tel_no'].'</div>';
		?>
		<div><div id="map_canvas"></div></div>
			</div>
		</td>
	</tr>
</table>

<script type="text/javascript">
$(function() {
	$("#demo5").paginate({
		count 		: <?php echo $total_pages;?>,
		start 		: 1,
		display     : 6,
		border					: false,
		border_color			: '#fff',
		text_color  			: '#00A5CF',
		background_color    	: 'white',	
		border_hover_color		: '#ccc',
		text_hover_color  		: '#006699',
		background_hover_color	: '#fff', 
		images					: false,
		mouse					: 'press',
		onChange     			: function(page){
        $('._current','#paginationdemo').removeClass('_current').hide();
        	$('#p'+page).addClass('_current').show();
        }
	});
});
</script>